<template>
    <UserForm @submit="handle_submit" />
</template>

<script>
import { logon } from "@/api"
import UserForm from "@/components/UserForm"

export default {
    components: {
        UserForm
    },
    methods: {
        handle_submit(data) {
            logon(data).then(
                () => {
                    this.$message({
                        message: "注册成功！",
                        type: "success"
                    })
                    this.$emit("toggle_page")
                },
                (err) => {
                    this.$message({
                        message: err,
                        type: "error"
                    })
                }
            )
        }
    }
}
</script>
